<template>
  <div>
    <header class="header">
      <h1>任务列表</h1>
      <input
        class="new-todo"
        v-model.trim="ipt"
        @keyup.enter="add"
        placeholder="请输入要做的事情"
        autofocus
      />
    </header>
  </div>
</template>

<script>
export default {
  name: "HeaDer",
  data () {
    return {
      ipt: ''
    }
  },
  methods: {
    // 回车点击数据
    add () {
      this.$emit('add', this.ipt)
      // 清空表单
      this.ipt = ''
    }
  }
};
</script>

<style lang='' scoped>
</style>